<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions">


    <ui:define name="content">


        <h:panelGroup rendered="true" >
            <h:form>
                <p:panel id="reportPrint" header="Casheir Session Report Detail">

                    <f:facet name="header" >
                        <h:outputLabel value="#{commonReport.webUser.institution.name}"/> <br/>
                        <h:outputLabel value="Cashier Summary Report - Opd Bills -&nbsp;&nbsp; #{commonReport.webUser.webUserPerson.name}"/>

                        <p:panelGrid columns="4" styleClass="printBlock">
                            <h:outputLabel value="From" />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                            <h:outputLabel value="To"/>
                            <h:outputLabel  value="#{commonReport.toDate}" style="float: right" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                        </p:panelGrid>

                        <p:commandButton ajax="false" value="Refresh" styleClass="noPrintButton" style="float: right;" />  
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="reportPrint" />
                        </p:commandButton>  
                        <p:commandButton ajax="false" value="Eport Excel" action="report_cashier_summery_by_user_print"  styleClass="noPrintButton" style="float: right;" >
                        </p:commandButton>  
                    </f:facet>


                    <p:panelGrid columns="6" style="min-width: 100%;" styleClass="noPrintButton">
                        <h:outputLabel styleClass="noPrintButton"  value="From"/>
                        <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To"/>
                        <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                        <h:outputLabel styleClass="noPrintButton" value="User Name"/>

                        <p:autoComplete  styleClass="noPrintButton" id="acNewPtArea" converter="webUs" completeMethod="#{webUserController.completeUser}"  var="pta"   itemLabel="#{pta.webUserPerson.name}" itemValue="#{pta}" forceSelection="true" value="#{commonReport.webUser}" >
                            <p:column >
                                <h:outputLabel value="#{pta.code}"/>
                            </p:column>
                            <p:column >
                                <h:outputLabel value="#{pta.webUserPerson.name}"/>
                            </p:column>
                        </p:autoComplete>


                    </p:panelGrid>

                    <p:dataTable rowStyleClass="noDisplayRow" id="report" value="#{commonReport.userBillsOwn.bills}" var="bb"  sortBy="#{bb.billType}" style=" text-align: right;" >

                        <p:column headerText="Opd Bill"  >
                            <h:outputLabel value="Total:"/>
                        </p:column>
                        <p:column headerText="Cash" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBillsOwn.cash}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Credit" style="text-align: right; " >
                            <h:outputLabel value="#{commonReport.userBillsOwn.credit}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>

                        </p:column>
                        <p:column  headerText="C Card" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBillsOwn.card}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 
                        <p:column  headerText="Cheque" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBillsOwn.cheque}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 
                        <p:column  headerText="Slip" style="text-align: right; ">
                            <h:outputLabel value="#{commonReport.userBillsOwn.slip}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column> 
                        <p:column/>

                        <p:column/>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column footerText="Total:">                                    
                                </p:column>
                                 <p:column footerText="#{commonReport.userBillsOwn.cash}"/>  
                                <p:column footerText="#{commonReport.userBillsOwn.credit}"/>  
                                <p:column footerText="#{commonReport.userBillsOwn.card}"/>  
                                <p:column footerText="#{commonReport.userBillsOwn.cheque}"/> 
                                <p:column footerText="#{commonReport.userBillsOwn.slip}"/>
                            </p:row>
                        </p:columnGroup>
                    </p:dataTable>

                    <p:spacer height="30"/>
                    <ez:tableCancelledBill bill="#{commonReport.userCancelledBillsOwn}"/>
                    <p:spacer height="30"/>
                    <ez:tableRefundBill bill="#{commonReport.userRefundedBillsOwn}"/>
                    <p:spacer height="30"/>
                    <ez:tablePaymentBill bill="#{commonReport.userPaymentBillsOwn}"/>
                    <p:spacer height="30"/>
                    <ez:tablePaymentCancel bill="#{commonReport.userPaymentCancelBillsOwn}"/>
                    <p:spacer height="30"/>
                    <ez:tablePettyPayment bill="#{commonReport.userPettyPaymentBills}" />
                    <p:spacer height="30"/>
                    <ez:tablePettyCancel bill="#{commonReport.userPettyPaymentCancelBills}"/>
                    <p:spacer height="30"/>
                    <ez:tableCompanyPayment bill="#{commonReport.userCashRecieveBills}" />
                    <p:spacer height="30"/>
                    <ez:tableCompanyCancel bill="#{commonReport.userCashRecieveBillCancel}" />
                    <p:spacer height="30"/>
                    <ez:tableAgentPayment bill="#{commonReport.userAgentRecieveBills}"/>
                    <p:spacer height="30"/>
                    <ez:tableAgentCancel bill="#{commonReport.userAgentRecieveBillCancel}"/>
                    <p:spacer height="30"/>                   
                    <ez:tableInwardPaymentBill bill="#{commonReport.userInwardPaymentBillsOwn}"/>
                    <p:spacer height="30"/>
                    <ez:tableInwardPaymentCancel  bill="#{commonReport.userInwardPaymentCancelBillsOwn}"/>

                    <p:spacer height="30"/>


                    <h:panelGrid columns="2" style="min-width: 100%;" >
                        <h:outputLabel value="Final Credit Total : "/>
                        <h:outputLabel style="font-weight: bold;float: right; "  value="#{commonReport.finalCreditTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                        <h:outputLabel value="Final Credit Card Total : "/>
                        <h:outputLabel style="font-weight: bold;float: right; "  value="#{commonReport.finalCreditCardTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                        <h:outputLabel value="Final Cheque Total : "/>
                        <h:outputLabel value="#{commonReport.finalChequeTot}" style="font-weight: bold;float: right; "  >
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                        <h:outputLabel value="Final Slip Total : "/>
                        <h:outputLabel  value="#{commonReport.finalSlipTot}" style="font-weight: bold;float: right; "   >
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                        <h:outputLabel value="Final Cash Total : "/>
                        <h:outputLabel style="font-weight: bold;float: right; "  value="#{commonReport.finalCashTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </h:panelGrid>

                    <h:outputLabel value="..........................."/>
                    <h:outputLabel value="..........................." style="float: right;"/><br/>
                    <h:outputLabel value="Cashier"/>
                    <h:outputLabel value="Date" style="float: right;"/>
                </p:panel>

            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
